package com.dy.system.service.impl;

import java.util.List;
import com.dy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dy.system.mapper.MedicalMachineMapper;
import com.dy.system.domain.MedicalMachine;
import com.dy.system.service.IMedicalMachineService;

/**
 * 【医疗设备管理】Service业务层处理
 *
 * @author anps
 * @date 2022-07-30
 */
@Service
public class MedicalMachineServiceImpl implements IMedicalMachineService{
    @Autowired
    private MedicalMachineMapper medicalMachineMapper;

    /**
     * 查询【医疗设备管理】
     *
     * @param id 【医疗设备管理】主键
     * @return 【医疗设备管理】
     */
    @Override
    public MedicalMachine selectMedicalMachineById(Long id){
        return medicalMachineMapper.selectMedicalMachineById(id);
    }

    @Override
    public MedicalMachine selectMedicalMachineByCode(String code) {
        return medicalMachineMapper.selectMedicalMachineByCode(code);
    }

    /**
     * 查询【医疗设备管理】列表
     *
     * @param medicalMachine 【医疗设备管理】
     * @return 【医疗设备管理】
     */
    @Override
    public List<MedicalMachine> selectMedicalMachineList(MedicalMachine medicalMachine){
        return medicalMachineMapper.selectMedicalMachineList(medicalMachine);
    }

    /**
     * 新增【医疗设备管理】
     *
     * @param medicalMachine 【医疗设备管理】
     * @return 结果
     */
    @Override
    public int insertMedicalMachine(MedicalMachine medicalMachine){
        medicalMachine.setCreateTime(DateUtils.getNowDate());
        return medicalMachineMapper.insertMedicalMachine(medicalMachine);
    }

    /**
     * 修改【医疗设备管理】
     *
     * @param medicalMachine 【医疗设备管理】
     * @return 结果
     */
    @Override
    public int updateMedicalMachine(MedicalMachine medicalMachine){
        medicalMachine.setUpdateTime(DateUtils.getNowDate());
        return medicalMachineMapper.updateMedicalMachine(medicalMachine);
    }

    /**
     * 批量删除【医疗设备管理】
     *
     * @param ids 需要删除的【医疗设备管理】主键
     * @return 结果
     */
    @Override
    public int deleteMedicalMachineByIds(Long[] ids){
        return medicalMachineMapper.deleteMedicalMachineByIds(ids);
    }

    /**
     * 删除【医疗设备管理】信息
     *
     * @param id 【医疗设备管理】主键
     * @return 结果
     */
    @Override
    public int deleteMedicalMachineById(Long id){
        return medicalMachineMapper.deleteMedicalMachineById(id);
    }
}
